package com.yulongtian.weekCompetition.month202301.week04;

/**
 * https://leetcode.cn/problems/minimum-common-value/
 * 可
 *
 * @author yulongTian
 * @create 2023-01-25 21:08
 */
public class Test11 {
    public static void main(String[] args) {

    }

    public static int getCommon(int[] nums1, int[] nums2) {

        for (int i = 0, j = 0; i < nums1.length && j < nums2.length; ) {
            if (nums1[i] == nums2[j]) {
                return nums1[i];
            }
            if (nums1[i] < nums2[j]) {
                i++;
                continue;
            }
            if (nums1[i] > nums2[j]) {
                j++;
            }
        }


        return -1;
    }
}
